package top.yudoge.dogeeditor.llm.util

import top.yudoge.dogeeditor.commons.utils.convert
import top.yudoge.dogeeditor.db.api.DataSourceMetaDataApi
import top.yudoge.dogeeditor.llm.objects.mro.TableMRO

fun DataSourceMetaDataApi.fetchMROByTableName(
    dsIdentifier: String,
    databaseName: String,
    schemaName: String,
    tableNames: List<String>
): List<TableMRO> {
    return tableNames.map { tableName ->
        TableMRO(
            tableName,
            this.getColumns(dsIdentifier, databaseName, schemaName, tableName).convert()
        )
    }
}